package com.jz.community.modulemine.integral.adapter;

import android.support.v4.content.ContextCompat;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.jz.community.modulemine.R;
import com.jz.community.modulemine.integral.bean.IntegralInfo;

import java.util.List;


/**
 * Created by Ani_H on 2018/1/11.
 */

public class IntegralAdapter extends BaseQuickAdapter<IntegralInfo.EmbeddedBean.ContentBean, BaseViewHolder> {

    public IntegralAdapter(int layoutResId, List<IntegralInfo.EmbeddedBean.ContentBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, IntegralInfo.EmbeddedBean.ContentBean item) {
        TextView text_type = helper.getView(R.id.text_type);
        TextView text_parameters = helper.getView(R.id.text_parameters);
        TextView text_time = helper.getView(R.id.text_time);
        TextView text_number = helper.getView(R.id.text_number);
        text_type.setText(item.getModleName());
        text_parameters.setText(item.getModleName());
        text_time.setText(item.getCreateTime());
        if (item.getComputingMethod().equals("0")) {
            text_number.setText("+" + item.getIntegral());
            text_number.setTextColor(ContextCompat.getColor(mContext, R.color.home_red));
        } else if (item.getComputingMethod().equals("1")) {
            text_number.setText("-" + item.getIntegral());
            text_number.setTextColor(ContextCompat.getColor(mContext, R.color.font_black));
        }
    }
}
